<template>
	<view class="cloumCenter">
		<appBar title="修改密码"></appBar>
		<view class="borderbottom w100">
			<lableInput label="手机号" placeholder="请输入手机号" v-model="resetInfo.phone" />
		</view>
		<view class="borderbottom w100">
			<codeInput v-model:smsCode="resetInfo.smsCode" :phone="resetInfo.phone" />
		</view>
		<PasswordInput label="密码" placeholder="请输入密码" v-model="resetInfo.password"></PasswordInput>

		<uv-gap height="40"></uv-gap>
		<view class="w90">
			<ThemeButton color="linear-gradient(300deg, #fd5f47 0%, #f9773d 100%)" text="提交" @click="resetPwd" />
		</view>
	</view>
</template>

<script setup>
import codeInput from '@/components/codeInput/codeInput.vue';

import { sendSmsApi, resetPwdApi } from '@/api/agentApi/setting.js';
import { reactive } from 'vue';

let resetInfo = reactive({
	phone: '',
	smsCode: '',
	password: ''
});

// 修改密码的方法
const resetPwd = async () => {
	let res = await resetPwdApi(resetInfo);
	console.log(res);
	if (res.code == 200) {
		uni.showToast({
			title: res.data,
			icon: 'none'
		});
		uni.navigateBack();
	} else {
		uni.showToast({
			title: res.msg,
			icon: 'none'
		});
	}
};
</script>

<style lang="scss" scoped></style>
